<template>
	<view class="container">
		<TopNav :title="title" bg-color="#fff"></TopNav>
		<view class="">
			<text v-html="content"></text>
		</view>
	</view>
</template>

<script>
	import {
		appConfig
	} from "@/api/document"
	export default {
		data() {
			return {
				title: '',
				content: '',
				appConfig: {}
			}
		},
		onLoad(query) {
			(async () => {
				this.title = query.title
				await this.getDetail()
				switch (query.title) {
					case "用户协议":
						this.content = this.appConfig.tech_instructions
						break;
					case "隐私政策":
						this.content = this.appConfig.tech_privacy
						break;
					case "合作机构及说明":
						this.content = this.appConfig.offline_certification_desc
						break;
					case "推广大使合作协议":
						this.content = this.appConfig.app_distribute_coop_agreement
						break;
					case "商家管理规则":
						this.content = this.appConfig.shop_manage_rules
						break;
					case "搭搭陪伴注销协议":
						this.content = this.appConfig.tech_cancellation
						break;
					case "如何进行线下认证":
						this.content = this.appConfig.offline_des
						break;
					case "如何加入专搭服务项目":
						this.content = this.appConfig.join_service_desc
						break;
					default:
						break;
				}
			})()

		},
		methods: {
			async getDetail() {
				// 获取应用配置
				await appConfig().then(res => {
					this.appConfig = res.data || {}
				}).catch(() => {
					this.appConfig = {}
				})
			}
		}
	}
</script>
<style>
	page {
		background-color: #fff;
	}
</style>
<style scoped lang="scss">
	page {
		padding-bottom: constant(safe-area-inset-bottom);
		padding-bottom: env(safe-area-inset-bottom);
	}

	.container {
		padding: 32rpx;
	}
</style>